﻿#include "CashContext.h"
#include "CashNormal.h"
#include "CashRebate.h"
#include "CashReturn.h"

CashContext::CashContext(int type)
{
    switch (type) {
    case 0:
        m_cs = new CashNormal();
        break;
    case 1:
        m_cs = new CashRebate("0.8");
        break;
    case 2:
        m_cs = new CashReturn("300", "100");
        break;
    default:
        break;
    }
}

double CashContext::GetResult(double money)
{
    return m_cs->acceptCash(money);
}

CashContext::~CashContext()
{
    delete m_cs;
}
